﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using WCF_DuplexClient.ServiceReference1;

namespace WCF_DuplexClient
{
    public class CallbackHandler : IDuplexSvcCallback
    {
        static InstanceContext site = new InstanceContext(new CallbackHandler());
        public static DuplexSvcClient proxy = new DuplexSvcClient(site);

        //public void ReceiveTime(string str)
        //{
        //    Console.WriteLine("Получено сообщение :\n" + str);
        //}
            

        public bool CheckDriver(int idTaxist)
        {
            return true;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            CallbackHandler.proxy.AddToQueue(5, 1);
            CallbackHandler.proxy.AddToQueue(2, 1);
            CallbackHandler.proxy.AddToQueue(25, 3);
            CallbackHandler.proxy.AddToQueue(35, 3);

            int drv = CallbackHandler.proxy.GetDriver(1);
            Console.WriteLine(drv);
            int drv2 = CallbackHandler.proxy.GetDriver(3);
            Console.WriteLine(drv2);
            int drv3 = CallbackHandler.proxy.GetDriver(1);
            Console.WriteLine(drv3);
            Console.ReadKey();
        }
    }
}
